<template>
	<div class="app_container" v-loading="loading">
		<div class="contentBox">
			<div class="content_chunk">
				<Info v-model="infoData" state="readonly"></Info>
			</div>
			<div class="content_chunk">
				<PriceAll v-model="infoData" state="readonly"></PriceAll>
			</div>
			<div class="content_chunk">
				<Content
					v-model="infoData"
					state="readonly"
					type="audit"></Content>
			</div>
		</div>
		<div>
			<A-FlowRecord :id="processId"></A-FlowRecord>
		</div>
	</div>
</template>

<script>
	import Info from '../chunk/info.vue';
	import Content from '../chunk/chunk.vue';
	import PriceAll from '../chunk/priceAll.vue';
	import FormItems from '@/views/finance/manage/formItems/index.vue';
	import * as apis from '@/api/finance/reimburs/preview/api.js';
	import Chunk from '../chunk/index.vue';

	export default {
		name: 'PreviewReimburs',
		components: { Chunk, FormItems, PriceAll, Content, Info },
		props: {
			state: {
				required: false,
				default: 'readonly',
			},
		},
		dicts: [
			'expense_use_type',
			'expense_use_type_car',
			'expense_use_type_pay',
			'expense_use_type_transport',
			'expense_use_type_registration',
			'expense_use_type_other',
			'expense_use_type_gps',
			'expense_business_cleancar',
			'expense_business_fuel',
			'expense_business_stopcar',
			'expense_business_road',
			'expense_business_car',
			'expense_business_pay',
			'expense_business_transport',
			'expense_business_registration',
			'expense_business_inspect',
			'expense_business_gps',
			'expense_business_other',
		],

		computed: {
			id() {
				return this.$route?.query?.id;
			},
			processId() {
				return this.$route.query.processId;
			},
			type() {
				return this.$route?.query?.type;
			},
		},
		data() {
			return {
				loading: true,
				formList: [],
				queryParams: {
					pageNum: 1,
					pageSize: 10,
				},
				checkedMenu: [],
				infoData: {
					contractType: [],
				},
				menu: [],
				dicts: {
					// 收款人类型
					payeeTypeList: [
						{
							label: '员工',
							value: '1',
						},
						{
							label: '司机',
							value: '2',
						},
						{
							label: '供应商',
							value: '3',
						},
					],
					contractTypeList: [
						{
							label: '短租',
							value: '1',
						},
						{
							label: '渠道',
							value: '2',
						},
						{
							label: '自营',
							value: '3',
						},
						{
							label: '代收代付',
							value: '4',
						},
					],

					needpayType: [
						{
							label: '是',
							value: '1',
						},
						{
							label: '否',
							value: '2',
						},
					],
					BusinessType: [],
				},
				tableData: [],
			};
		},
		watch: {
			// menu: {
			//     handler: function (val) {
			//         // console.log(val);
			//     },
			//     deep: true,
			// },
			// infoData: {
			//     handler: function (val) {
			//         console.log(val);
			//     },
			//     deep: true,
			// },
			//   '$route.query.id':{
			//       handler(val){
			//         if(val){
			//           this.initData();
			//         }
			//       },
			//       immediate:true,
			//   }
		},
		async mounted() {
			// console.log(this.getDicts("expense_business_1"));

			await this.getBusinessType();

			this.initInfo();
			this.initMenu();
			this.menuBindDict();
			this.initData();
		},
		filters: {
			filterBusinessType: (row, dict) => {
				if (!row) return '-';
				let ele = dict.find(item => {
					return item.index == row;
				});
				return ele?.value ?? '-';
			},
			filterNeedpayType(row, dict) {
				if (!row) return '-';
				let ele = dict.find(item => {
					return item.value == row;
				});
				return ele?.label ?? '-';
			},
		},
		methods: {
			exportFile() {},
			formatTableSpan(data, key) {
				if (
					Object.prototype?.toString?.call(data) !== '[object Array]'
				) {
					throw new Error('arguments[0] not is a Array');
				}
				if (data.length <= 1) return;
				let targetIndex = 0;
				key ??= 'error';
				if (key == 'error') throw new Error("can't get prop");
				data.forEach((item, index) => {
					if (index == targetIndex) {
						let len = data.findLastIndex(e => e[key] == item[key]);
						item.__col = len - targetIndex + 1;
						targetIndex = len + 1;
					} else if (index < targetIndex) {
						item.__col = 0;
					}
				});
			},
			arraySpanMethod({ row, column, rowIndex, columnIndex }) {
				if (columnIndex == 0 || columnIndex == 3) {
					if ('__col' in row) {
						return [row.__col, 1];
					} else {
						return [0, 0];
					}
				} else {
					return [1, 1];
				}
			},
			getSummaries({ columns, data }) {
				let sum = [];
				columns.forEach((element, index) => {
					if (index == 0) {
						element.colSpan = columns.length - 2;
					} else if (index == 1) {
						element.colSpan = 2;
					}
				});
				sum.push('合计');
				sum.push(this.infoData.sumMoney ?? 0);
				return sum;
			},
			getDateDuration(startTime, endTime) {
				let result = '-';
				let start = this.$dayjs(startTime);
				let end = this.$dayjs(endTime);
				let duration = this.$dayjs.duration(end.diff(start));
				let H_all = duration.as('hours');
				let D = parseInt(H_all / 24);
				let H = (H_all % 24).toFixed(1)?.split('.');
				if (D == 0) {
					result = `${H} 小时`;
				} else if ((H?.[0] == 0 && H?.[1] == 0) || (!H[0] && !H[1])) {
					result = `${D} 天`;
				} else if (H?.[1] == 0) {
					result = `${D} 天 ${H[0]} 小时`;
				} else {
					result = `${D} 天 ${H[0]}.${H[1]} 小时`;
				}
				return result;
			},
			menuBindDict() {
				this.dicts.BusinessType.map(item => {
					let child = this.menu.find(e => e.title === item.value);
					if (child) {
						this.$set(child, 'dictType', item.dictType);
						this.$set(child, 'value', item.index);
					}
				});
			},
			getBusinessType() {
				return new Promise((resolve, reject) => {
					this.loading = true;
					let params = {};
					apis?.BusinessType(params)
						.then(res => {
							this.dicts.BusinessType = res.data;
						})
						.catch(err => {
							reject();
						})
						.finally(() => {
							this.loading = false;
							resolve();
						});
				});
			},
			initData() {
				this.loading = true;
				if (this.Empty(this.id)) return;
				apis?.Details(this.id)
					.then(res => {
						if (res.code == 200) {
							let data = res.data;

							// data?.businessTypeVos.map((item) => {
							//     this.checkedMenu.push(item.businessType * 1);
							// });
							// this.menu.map((item) => {
							//     let vos = data?.businessTypeVos?.find(
							//         (e) => e.businessType == item.value
							//     );
							//     if (!!vos) {
							//         item.data = vos;
							//         item.data.list = vos?.businessInfoVos ?? [];
							//         Reflect.deleteProperty(
							//             item.data,
							//             "businessInfoVos"
							//         );
							//     }
							// });

							this.infoData = data;
							// this.infoData.contractType =
							//     this.infoData?.contractType?.split?.(",");
							// Reflect.deleteProperty(
							//     this.infoData,
							//     "businessInfoGroupVos"
							// );
							// Reflect.deleteProperty(
							//     this.infoData,
							//     "businessTypeVos"
							// );
						}
					})
					.finally(() => {
						this.loading = false;
					});
			},
			async getDictPriceTypeList(dictID) {
				return await this.getDicts(dictID);
			},

			initInfo() {
				this.formList = [
					{
						label: '所属公司',
						type: 'select_dialog',
						propLabel: 'companyName',
						prop: 'companyId',
						selectDialogParams: {
							type: 'company',
							title: '请选择公司',
						},
						rules: [
							{
								required: true,
								message: '请选择公司',
								trigger: 'change',
							},
						],
						rulesProp: 'companyId',
						cb: (res, row) => {
							this.$set(row, 'companyName', res.companyName);
							this.$set(row, 'companyId', res.companyId);
							this.menu.map(item => {
								item?.data?.list?.map(ele => {
									this.$emit(
										ele,
										'companyName',
										res.companyName,
									);
									this.$set(ele, 'companyId', res.companyId);
								});
							});
						},
					},
					{
						label: '使用日期',
						type: 'datePicker',
						prop: 'payTime',
						clounmMinWidth: '200px',
						datePickerType: 'month',
						valueFormat: 'yyyy-MM',
					},
					{
						label: '收款人类型',
						type: 'radioGroup',
						prop: 'payeeType',
						radioGroupList: this.dicts.payeeTypeList,
					},
					{
						label: '合同类型',
						type: 'checkboxGroup',
						prop: 'contractType',
						checkboxGroupList: this.dicts.contractTypeList,
					},
					{
						label: '选择收款人',
						type: 'select',
						prop: 'payeeUserId',
						selectList: [],
					},
					{
						label: '收款人名称',
						type: 'input',
						prop: 'payeeUserName',
					},
					{
						label: '收款账号',
						type: 'input',
						prop: 'paymentCardId',
					},
					{
						label: '收款账户开户行名称',
						type: 'input',
						prop: 'paymentAccount',
					},
				];
			},
			audit() {
				this.$modal.loading('正在保存...');
				let params = [];
				this.infoData?.businessInfoGroupVos?.map(item => {
					params.push({
						id: item.id,
						remark4: item.remark4,
					});
				});

				apis?.Audit(params)
					.then(res => {
						if (res.code == 200) {
							this.$message.success('保存成功');
							const obj = this.$route;
							this.$tab.closeOpenPage(obj).then(() => {
								this.$router.push({
									path: '/finance/reimburs',
								});
							});
						}
					})
					.finally(res => {
						this.$modal.closeLoading();
					});
			},
			async valid() {
				let components = this.$refs.chunk;
				let result = true;

				for (let index = 0; index < components.length; index++) {
					const element = components[index];
					let pass = await element?.validate();
					if (
						this.checkedMenu.includes(
							element?.infoData?.businessType * 1,
						)
					) {
						result = result && pass;
					}
				}
				let infoData_copy = this._.cloneDeep(this.infoData);
				let menu_copy = this._.cloneDeep(this.menu);
				let params = Object.assign({}, infoData_copy, {
					businessTypeMap: {},
					businessInfoMap: {},
				});
				menu_copy = menu_copy.filter(item =>
					this.checkedMenu.includes(item.value),
				);
				menu_copy.map(item => {
					params.businessTypeMap[item.value] ??= {};
					params.businessInfoMap[item.value] ??= [];
					item.data.list ??= [];
					if (item.data?.invoiceUploadType == 2) {
						this.resetInvoice(item.data);
					}
					Object.keys(item.data).map(key => {
						if (key == 'list') {
							if (
								item?.data?.list &&
								item?.data?.list?.length > 0
							) {
								params.businessInfoMap[item.value] =
									item?.data?.list;
							}
						}
					});

					delete item.data.list;
					// if (Object.keys(item.data).length > 0) {
					params.businessTypeMap[item.value] = {
						...item.data,
						businessType: item.value,
					};
					// }
				});
				params.contractType = params.contractType.join(',');
				// if (this.id) params.id = this.id;
				// console.log(this.menu);
				// console.log(result);
				// return;
				if (result) {
					this.$modal.loading('正在保存...');
					let method = this.$route.query.id ? apis?.Save : apis?.Save;
					method?.(params)
						.then(res => {
							if (res.code == 200) {
								this.$message.success('保存成功');
								const obj = this.$route;
								this.$tab.closeOpenPage(obj).then(() => {
									this.$router.push({
										path: '/finance/reimburs',
									});
								});
							}
						})
						.finally(res => {
							this.$modal.closeLoading();
						});
				}
			},
			resetInvoice(item) {
				item.invoiceOssId = '';
				item.otherOssId = '';
				item.invoiceType = '';
				item.invoiceMoney = '';
				item.taxMoney = '';
				item.taxRate = '';
			},
			// 设置chunk需要的数据
			initItemData(key, data = {}) {
				let item = this.menu.find(item => {
					return item.value == key;
				});
				if (!item) return;
				item.data = data;
			},
			// 初始化生成title和elTableColumn
			initMenu() {
				this.menu.push(this.initMenu_Car());
				this.menu.push(this.initMenu_Resource());
				this.menu.push(this.initMenu_Stop());
				this.menu.push(this.initMenu_Road());
				this.menu.push(this.initMenu_CarServer());
				this.menu.push(this.initMenu_Recharge());
				this.menu.push(this.initMenu_Transoirt());
				this.menu.push(this.initMenu_License());
				this.menu.push(this.initMenu_Check());
				this.menu.push(this.initMenu_GPS());
				this.menu.push(this.initMenu_Other());
				this.menu.push(this.initMenu_Driver());
			},
			// 洗车
			initMenu_Car() {
				return {
					title: '洗车',
					status: 'write',
					data: {
						companyName: '',
					},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this?.dict?.type?.expense_business_cleancar ??
								[],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},
						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type ?? [],
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},
						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},

			// 燃油&充电&加气
			initMenu_Resource() {
				return {
					title: '燃油&充电&加气',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this?.dict?.type?.expense_business_fuel ?? [],
							rules: [
								{
									required: true,
									message: '请选择活动区域',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},
						{
							label: '卡号',
							prop: 'card',
							type: 'input',
						},
						{
							label: '剩余金额',
							prop: 'residueMoney',
							type: 'text',
						},
						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
							status: 'readonly',
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type ?? [],
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},
						{
							label: '加油量（升）',
							type: 'input_number',
							prop: 'addFuel',
						},
						{
							label: '起始时间',
							prop: 'startTime',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '结束时间',
							prop: 'endTime',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '起始地点',
							type: 'input',
							prop: 'startAddress',
						},
						{
							label: '结束地点',
							type: 'input',
							prop: 'endAddress',
						},
						{
							label: '起始里程',
							type: 'input_number',
							prop: 'startMileage',
						},
						{
							label: '结束里程',
							type: 'input_number',
							prop: 'stopMileage',
						},
						{
							label: '使用里程',
							type: 'input_number',
							prop: 'useMileage',
						},
						{
							label: '平均油耗（L）',
							type: 'input_number',
							prop: 'aveFuelCost',
						},
						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},

			// 停车
			initMenu_Stop() {
				return {
					title: '停车',
					status: 'write',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this?.dict?.type?.expense_business_stopcar ??
								[],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type ?? [],
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '起始时间',
							type: 'datePicker',
							prop: 'startTime',
							clounmMinWidth: '200px',
							datePickerType: 'datetime',
							format: 'yyyy-MM-dd HH:mm',
							cb: row => {
								if (row?.startTime && row?.endTime) {
									let duration = this.getDateDuration(
										row.startTime,
										row.endTime,
									);
									this.$set(row, 'stopTime', duration);
								}
							},
						},
						{
							label: '结束时间',
							type: 'datePicker',
							prop: 'endTime',
							clounmMinWidth: '200px',
							datePickerType: 'datetime',
							format: 'yyyy-MM-dd HH:mm',
							pickerOptionsCB: row => {
								let options = {
									disabledDate: time => {
										let pass = true;
										let timeF =
											this.$dayjs(time).format(
												'YYYY-MM-DD',
											);
										let endTimeF = this.$dayjs(
											row.startTime,
										).format('YYYY-MM-DD');
										if (row.startTime) {
											let isAfter =
												this.$dayjs(timeF).isBefore(
													endTimeF,
												);
											pass = isAfter;
										}

										return pass;
									},
								};
								return options;
							},

							cb: row => {
								if (row?.startTime && row?.endTime) {
									let duration = this.getDateDuration(
										row.startTime,
										row.endTime,
									);
									this.$set(row, 'stopTime', duration);
								}
							},
						},
						{
							label: '停放时间',
							type: 'text',
							prop: 'stopTime',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},

						{
							label: '起始地点',
							type: 'input',
							prop: 'startAddress',
						},
						{
							label: '结束地点',
							type: 'input',
							prop: 'endAddress',
						},

						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// 路桥费
			initMenu_Road() {
				return {
					title: '路桥费',
					status: 'write',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this?.dict?.type?.expense_business_road ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList: this.dict?.type?.expense_use_type ?? [],
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},

						{
							label: '办公车牌',
							prop: 'workCarCard',
							type: 'input',
						},
						{
							label: '起始时间',
							prop: 'startTime',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '结束时间',
							prop: 'endTime',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '起始地点',
							type: 'input',
							prop: 'startAddress',
						},
						{
							label: '结束地点',
							type: 'input',
							prop: 'endAddress',
						},

						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// 车务费用
			initMenu_CarServer() {
				return {
					title: '车务费用',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type?.expense_business_car ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},

						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectList:
								this.dict?.type?.expense_use_type_car ?? [],
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},

						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// 充值费用
			initMenu_Recharge() {
				return {
					title: '充值费用',
					data: {},
					tableClounmOptions: [
						{
							label: '区分',
							type: 'select',
							prop: 'differenceType',
							selectList: [],
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							valueFormat: 'yyyy-MM-dd',
							datePickerType: 'date',
						},
						// {
						//     label: "使用人",
						//     type: "select_dialog",
						//     prop: "userName",
						//     propLabel: "orderName",
						//     select_dialog: {
						//         type: "user",
						//         title: "请选择使用人",
						//     },
						//     cb: (val) => {
						//         console.log(val);
						//     },
						// },
						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},
						{
							label: '充值类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList: [],
						},

						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type?.expense_use_type_pay ?? [],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '卡号',
							prop: 'card',
							type: 'input',
						},
						{
							label: '充值金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},

						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// 运输
			initMenu_Transoirt() {
				return {
					title: '运输',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type?.expense_business_transport ??
								[],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type?.expense_use_type_transport ??
								[],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},
						{
							label: '物流公司',
							prop: 'logisticsCompany',
							type: 'input',
						},
						{
							label: '起运时间',
							prop: 'startTransportTime',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '物流开始城市',
							prop: 'startLogisticsCity',
							type: 'input',
						},
						{
							label: '物流结束城市',
							prop: 'endLogisticsCity',
							type: 'input',
						},
						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},

						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// 上牌
			initMenu_License() {
				return {
					title: '上牌',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type
									?.expense_business_registration ?? [],
							rules: [
								{
									required: true,
									message: '请选择活动区域',
									trigger: 'change',
								},
							],
							rulesProp: 'priceType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type
									?.expense_use_type_registration ?? [],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},

						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// 年检
			initMenu_Check() {
				return {
					title: '年检',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type?.expense_business_inspect ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},
						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type?.expense_use_type_other ?? [],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},

						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// GPS
			initMenu_GPS() {
				return {
					title: 'GPS',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type?.expense_business_gps ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},

						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},
						{
							label: 'GPS品牌',
							prop: 'gpsBrand',
							type: 'input',
						},
						{
							label: '安装/续费产品',
							prop: 'installRenewProduct',
							type: 'select',
							selectList: [
								{
									label: '有线+无线',
									value: 1,
								},
								{
									label: '有线',
									value: 2,
								},
								{
									label: '无线',
									value: 3,
								},
							],
						},

						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',

							selectList:
								this.dict?.type?.expense_use_type_gps ?? [],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},

						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// 其他费用&运行费
			initMenu_Other() {
				return {
					title: '其他费用&运行费',
					data: {},
					tableClounmOptions: [
						{
							label: '选择订单',
							prop: 'orderID',
							propLabel: 'orderName',
							type: 'select_dialog',
							selectDialogParams: {
								type: 'order',
								title: '请选择订单',
							},
							selectDialogValidate: row => {
								if (!row?.companyId) {
									this.$message({
										message: '请选择所属公司',
										type: 'warning',
									});
									return false;
								}
								return true;
							},
							cb: val => {
								console.log(val);
							},
						},
						{
							label: '所属公司',
							prop: 'companyName',
							type: 'text',
						},
						{
							label: '使用日期',
							prop: 'useDate',
							type: 'datePicker',
							clounmMinWidth: '200px',
							datePickerType: 'date',
							valueFormat: 'yyyy-MM-dd',
						},
						{
							label: '费用类型',
							prop: 'costType',
							type: 'select',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',
							selectList:
								this.dict?.type?.expense_business_other ?? [],
							rules: [
								{
									required: true,
									message: '请选择费用类型',
									trigger: 'change',
								},
							],
							rulesProp: 'costType',
						},

						{
							label: '使用人',
							prop: 'userName',
							type: 'input',
						},

						{
							label: '车牌',
							prop: 'carCard',
							type: 'text',
						},
						{
							label: '车架号',
							prop: 'carVin',
							type: 'text',
						},
						{
							label: '金额',
							prop: 'money',
							type: 'input_number',
						},
						{
							label: '合同类型',
							prop: 'contractSubType',
							type: 'select',
							selectList: this.dicts.contractTypeList,
						},
						{
							label: '新车/旧车',
							prop: 'carType',
							type: 'text',
						},
						{
							label: '车型',
							prop: 'carModel',
							type: 'text',
						},
						{
							label: '车辆类型',
							prop: 'carTypes',
							type: 'text',
						},
						{
							label: '燃油型号',
							prop: 'carFuelModel',
							type: 'text',
						},
						{
							label: '登记类型',
							prop: 'registType',
							type: 'text',
						},

						{
							label: '办理用途',
							type: 'select',
							prop: 'handleUseType',
							selectLabel: 'dictLabel',
							selectValue: 'dictValue',

							selectList:
								this.dict?.type?.expense_use_type_other ?? [],
						},
						{
							label: '办理事项（详细）',
							prop: 'handleInfo',
							type: 'textarea',
						},
						{
							label: '客户',
							prop: 'customUserName',
							type: 'text',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},
						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
			// 司机费
			initMenu_Driver() {
				return {
					title: '司机费',
					data: {},
					tableClounmOptions: [
						// {
						//     label: "劳务公司",
						//     prop: "orderID",
						//     propLabel: "orderName",
						//     type: "select_dialog",
						//     select_dialog: {
						//         type: "company",
						//         title: "请选择劳务公司",
						//     },
						//     cb: (val) => {
						//         console.log(val);
						//     },
						// },
						{
							label: '劳务公司',
							prop: 'laborCompany',
							type: 'input',
						},
						{
							label: '区分',
							type: 'select',
							prop: 'differenceType',
							selectList: [],
						},
						{
							label: '上月人数',
							prop: 'lastMonthSum',
							type: 'text',
						},
						{
							label: '上月金额',
							prop: 'lastMonthMoney',
							type: 'text',
						},
						{
							label: '本月人数',
							prop: 'monthSum',
							type: 'text',
						},
						{
							label: '本月金额',
							prop: 'monthMoney',
							type: 'text',
						},
						{
							label: '差异人数',
							prop: 'differenceSum',
							type: 'text',
						},
						{
							label: '差异金额',
							prop: 'differenceMoney',
							type: 'text',
						},
						{
							label: '差异原因',
							prop: 'differenceReason',
							type: 'text',
						},
						{
							label: '对外支付金额（元）',
							prop: 'money',
							type: 'text',
						},

						{
							label: '备注1',
							prop: 'remark1',
							type: 'textarea',
						},
						{
							label: '备注2',
							prop: 'remark2',
							type: 'textarea',
						},
						{
							label: '备注3',
							prop: 'remark3',
							type: 'textarea',
						},
						{
							label: '是否需要支付',
							prop: 'payFlag',
							type: 'select',
							selectList: this.dicts.needpayType,
						},
						{
							label: '上传发票',
							prop: 'file',
							type: 'upload',
							prototype: {
								limit: 1,
								listType: 'text',
								fileType: ['png', 'jpg', 'jpeg'],
								isShowTip: false,
							},
						},

						{
							label: '发票类型',
							prop: 'invoiceType',
							type: 'select',
							selectList: [
								{
									label: '专票',
									value: 1,
								},
							],
						},
						{
							label: '税率',
							prop: 'taxRate',
							type: 'input_number',
						},
						{
							label: '税额',
							prop: 'taxMoney',
							type: 'input_number',
						},
						{
							label: '含税金额',
							prop: 'includeTaxMoney',
							type: 'input_number',
						},
						{
							label: '不含税金额',
							prop: 'unincludeTaxMoney',
							type: 'input_number',
						},
					],
				};
			},
		},
	};
</script>

<style scoped lang="scss">
	.app_container {
		background-color: #f0f2f5;
		display: flex;
		.contentBox {
			flex: 1;
			min-width: 0;
		}
		.container {
			border-radius: 10px;
			background-color: #fff;
			margin: 20px;
			padding: 20px;
			.container_title {
				margin-bottom: 30px;
				padding: 0px 0 20px 0;
				border-bottom: 1px solid #191919;
				font-size: 16px;
				color: #333;
				font-weight: 600;
				display: flex;
				justify-content: space-between;
			}
			.container_content {
				// padding: 20px;
			}
		}
	}
	.chunk_nav {
		background-color: #fff;
		// padding: 20px 0;
		.nav_item {
			padding-bottom: 30px;
			display: flex;

			.label {
				width: 250px;
				text-align: right;
				padding-right: 25px;
				box-sizing: border-box;
			}
			.content {
				flex: 1;
				min-width: 0;
				padding-right: 50px;
				.menu {
					display: grid;
					grid-template-columns: repeat(6, 1fr);
					gap: 5px 0;
				}
			}
		}
	}
	.chunk_contentBox {
		background-color: #fff;
		// padding: 25px;
		.chunk {
			margin-bottom: 50px;
		}
	}
	::v-deep .gridBox {
		padding-top: 0;
	}

	.component-fade-enter, .component-fade-leave-to
/* .component-fade-leave-active for below version 2.1.8 */ {
		transform: translateX(100px);
		opacity: 0;
	}

	.component-fade-enter-active,
	.component-fade-leave-active {
		transition: all 0.8s;
	}

	.remake {
		margin-top: 15px;
		display: flex;
		.content {
			flex: 1;
		}
	}
	.handleBox {
		margin: 0 15px 15px 0;
		display: flex;
		justify-content: flex-end;
		padding-bottom: 15px;
	}
	.content_chunk {
		margin: 20px;
		background-color: #fff;
	}
</style>
